#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QSerialPort>
#include <QTimer>
#include "thread_freshport.h"
#include "downloadthread.h"
#include <QByteArray>
#include <QMutex>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void on_btn_Download_clicked();
    void on_btn_connect_clicked();
    void on_toolButton_clicked();

    void on_pushButton_clicked();

private:
    Ui::MainWindow *ui;
    Thread_FreshPort *TFPort;
    DownloadThread *DownLoadTaskHandler;
    QThread *xthread;
    quint8 StFlag;
    QMutex *Mutex;

public slots:
    void SeriaPortOff(void);
    void SeriaPortON(void);
    void File_NotExist(void);
    void File_OpenError(void);
    void SendingProgress(int value);
    void DownLoad_IsSuccess(int reply);

signals:
    void onDownLoad_Handler(QString FilePath);
    void onOpenSeriaPort(QString PortName);

};
#endif // MAINWINDOW_H
